package com.sline.Test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;

public class Demo1_Client {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1", 12345);
        BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        PrintStream ps = new PrintStream(socket.getOutputStream());

        Scanner sc = new Scanner(System.in);
        while (true) {
            String line = sc.nextLine();
            ps.println(line);

            String msg = br.readLine();

            System.out.println("客户端收到数据: " + msg);
        }
    }
}
